<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加</title>
    <#assign base=request.contextPath  />
    <base id="base" href="${base}">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${base}/static/win10/component/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${base}/static/style/commen.css" media="all">
    <script>
        var base = "${base}";
    </script>
</head>
<body>
<br>
<form class="layui-form " action="">
    <div class="layui-form-item">
        <label class="layui-form-label">账户名称</label>
        <div class="layui-input-block">
            <input type="text" id="userName" name="userName" autocomplete="off" placeholder="请输入账户名称"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">单位名称</label>
        <div class="layui-input-block">
            <input type="text" id="companyName" name="companyName" autocomplete="off" placeholder="请输入单位名称"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">邮箱</label>
        <div class="layui-input-inline">
            <input type="text" id="email" name="email" autocomplete="off" placeholder="请输入邮箱"
                   class="layui-input">
        </div>
  <#--      <div class="layui-form-mid layui-word-aux">
            <div id="sendMailLoadingDiv">
            </div>
            <button type="button" id="sendMail" class="layui-btn layui-btn layui-btn-sm">验证邮箱</button>

        </div>-->
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机号</label>
        <div class="layui-input-block">
            <input type="text" id="phone" name="phone" autocomplete="off" placeholder="请输入手机号"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="passWord" id="passWord" name="passWord" autocomplete="off" placeholder="请输入密码"
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">重复密码</label>
        <div class="layui-input-block">
            <input type="passWord" id="passWord2" name="passWord" autocomplete="off" placeholder="请输入密码"
                   class="layui-input">
        </div>
    </div>


    <div align="center">
        <button type="button" class="layui-btn" id="submit">保存</button>
    </div>
</form>

<script src="${base}/static/win10/component/layui/layui.js?t=1"></script>
<script src="${base}/static/win10/js/jquery-1.8.3.min.js?t=1"></script>
<script>
    layui.use(['table','form', 'layer','transfer'], function () {
        var table = layui.table;
        var form = layui.form
            , layer = layui.layer;
        var transfer = layui.transfer;







        $("#submit").on("click", function () {
            var formDate = {
                userName: $("#userName").val(),
                companyName: $("#companyName").val(),
                email: $("#email").val(),
                code: $("#code").val(),
                phone: $("#phone").val(),
                passWord: $("#passWord").val()
            }
            $.ajax({
                type: "POST",
                url: base + "/aircraftanalysis/user/admin/addUser",
                data: formDate,
                success: function (data) {
                    layer.msg(data.message)
                    if (data.code === 200) {
                        window.location.href = base + "/aircraftanalysis/user/admin/main.html"
                    } else {

                    }
                }
            });
        })


        function check() {

            if ($("#userName").val().length < 1) {
                layer.msg("请输入账户名称");
                return false;
            }
            if ($("#companyName").val().length < 1) {
                layer.msg("请输入单位名称");
                return false;
            }
            if ($("#email").val().length < 1) {
                layer.msg("请输入邮箱");
                return false;
            }
            if ($("#phone").val().length < 1) {
                layer.msg("请输入手机号");
                return false;
            }
            if ($("#passWord").val().length < 1) {
                layer.msg("请输入密码");
                return false;
            }

            if ($("#passWord").val()!=$("#passWord2").val()) {
                layer.msg("两次密码不匹配");
                return false;
            }
        }
    });

</script>
</body>
</html>